<template>
    <div>
        <h3>会员列表</h3>
        <table class="table table-bordered">
            <tbody >
                <tr class="bg-primary">
                    <td>会员id</td>
                    <td>会员卡号</td>
                    <td>会员手机号</td>
                    <td>会员名称</td>
                    <td>会员级别</td>
                    <td>会员生日</td>
                    <td>性别</td>
                    <td>积分</td>
                    <td>余额</td>
                    <td>会员爱好</td>
                    <td>会员简介</td>
                    <td>操作</td>
                </tr>
                <tr v-for="item in list" :key="item.Id">
                    <td>{{ item.Id }}</td>
                    <td>{{ item.Card }}</td>
                    <td>{{ item.Phone }}</td>
                    <td>{{ item.MemberName }}</td>
                    <td>{{ item.MemberLevelName }}</td>
                    <td>{{ item.BirthDay }}</td>
                    <td>{{ item.Sex==1?'男':'女' }}</td>
                    <td>{{ item.Points }}</td>
                    <td>{{ item.Money }}</td>
                    <td>{{ item.Likes}}</td>
                    <td>{{ item.Desc }}</td>
                    <td>
                        <input type="button" value="删除" class="btn btn-danger" @click="del(item.id)">
                        <input type="button" value="修改" class="btn btn-success">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import axios from 'axios';
import moment from 'moment';
import { useRoute, useRouter } from 'vue-router';
const Route = useRoute();
const Router = useRouter();

let list:any=ref([]);
let Query:any=reactive({
    MemberName:'',
    MemberLevelName:''
})
onMounted(()=>{
    getlist();
})
const del=(id:any)=>{
    axios({
        url:'',
        method:'',
        params:{
            Id:id
        }
    })
    .then((res)=>{
        console.log(res);
        if(res.data>0)
        {
            alert("删除成功");
            return;
        }
        else{
            alert("删除失败");
            return;
        }
    })
    .catch((err)=>{
        console.log(err);
    })
}
const getlist=()=>{
    axios({
        url:'/api/VIP/GetVIP',
        method:'get',
        params:Query
    })
    .then((res)=>{
        console.log(res);
        list.value=res.data;
    })
    .catch((err)=>{
        console.log(err);
        
    })
}


</script>

<style scoped>

</style>